#pragma once

DEF_EVT_EXT(EventJsonRootLButtonDown, EVT_EXTERNAL_BEGIN + 5001, {
});


class CJsonRoot : public SWindow
{
	DEF_SOBJECT(SWindow, L"json_root")
public:
	CJsonRoot(void);
	~CJsonRoot(void);

protected:
	LRESULT OnCreate(LPVOID);
	void OnPaint(IRenderTarget* pRT);

	void OnLButtonDown(UINT nFlags, SOUI::CPoint point);
	void OnLButtonUp(UINT nFlags, SOUI::CPoint point);
	void OnMouseMove(UINT nFlags, SOUI::CPoint point);
protected:
	SOUI_MSG_MAP_BEGIN()
		MSG_WM_CREATE(OnCreate)
		MSG_WM_PAINT_EX(OnPaint)

 		MSG_WM_LBUTTONDOWN(OnLButtonDown)
 		MSG_WM_LBUTTONUP(OnLButtonUp)
 		MSG_WM_MOUSEMOVE(OnMouseMove)
// 		MSG_WM_MOUSEHOVER(OnMouseHover)
// 		MSG_WM_MOUSELEAVE(OnMouseLeave)
		SOUI_MSG_MAP_END()

public:
	SOUI::CPoint m_ptLT;
private:
	bool	m_bSelected;
	bool	m_bMove;
	SOUI::CPoint	m_ptDown;

	std::vector<SWindow*>	m_vecChildren;
	SWindow* m_pObjParent;
public:
	void SetSelect(bool bSelect);

	void setObjParent(SWindow* pParent);
	SWindow* getObjParent();

	void addRootChild(SWindow* pWindow);
	std::vector<SWindow*> getRootChildren();
};

